﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>编辑留言</title>
    <link href="~/Areas/Back/lib/layui/css/layui.css" rel="stylesheet" />
    <script src="~/Areas/Back/lib/layui/layui.js"></script>
</head>
<body>
    <div class="layui-container" style="margin-top:50px;margin-bottom:150px">
        @*不要from提交*@
        <form class="layui-form" id="addFrom" onsubmit="return false">
            <input type="hidden" id="Id" value="@ViewBag.A.Id" />
            @*名字*@
            <div class="layui-form-item">
                <label class="layui-form-label">名字</label>
                <div class="layui-input-block">
                    <input type="text" id="Name" class="layui-input" value="@ViewBag.A.Name" placeholder="请输入名字" />
                </div>
            </div>
            @*电话*@
            <div class="layui-form-item">
                <label class="layui-form-label">电话</label>
                <div class="layui-input-block">
                    <input type="text" id="Tel" class="layui-input" value="@ViewBag.A.Tel" placeholder="请输入电话" />
                </div>
            </div>
            @*邮箱*@
            <div class="layui-form-item">
                <label class="layui-form-label">邮箱</label>
                <div class="layui-input-block">
                    <input type="text" id="Email" class="layui-input" value="@ViewBag.A.Email" placeholder="请输入邮箱" />
                </div>
            </div>
            @*留言状态*@
            <div class="layui-form-item">
                <label class="layui-form-label">留言状态</label>
                <div class="layui-input-block">
                    <input type="text" id="Status" class="layui-input" readonly value="@ViewBag.A.Status" />
                </div>
            </div>
            @*内容*@
            <div class="layui-form-item">
                <label class="layui-form-label">内容</label>
                <div class="layui-input-block">
                    <textarea id="Cont" class="layui-textarea" placeholder="请输入内容">@ViewBag.A.Cont</textarea>
                </div>
            </div>
            @*内容*@
            @if (ViewBag.A.Status == "已回复")
            {
            <div class="layui-form-item">
                <label class="layui-form-label">回复内容</label>
                <div class="layui-input-block">
                    <textarea id="Answer" class="layui-textarea" placeholder="请输入内容">@ViewBag.A.Answer</textarea>
                </div>
            </div>
            }
        </form>
    </div>
</body>
<script>
    layui.use(['form', 'layedit', 'upload'], function () {
        var form = layui.form;
        var layedit = layui.layedit;
        var layer=layui.layer;
        var upload = layui.upload;
        var $ = layui.$;
        //开始处理点击提交
        form.on('submit(subAdd)', function () {
            //ajax 请求
            $.ajax({
                url: "Status",
                method: "post",
                dataType: "json",
                data: {
                    Id: $("#Id").val()
                   
                },
                success: function (res) {
                    if (res.success == true) {
                        //layer.msg(res.msg);
                        //关闭当前窗口，并且刷新列表
                        //1.获取弹窗的编号
                        //var index = parent.layer.getFrameIndex(window.name);
                        //2.关闭窗口
                        //parent.layer.close(index);
                        //3.刷新父级页面
                        parent.location.reload();
                    } else {
                        layer.msg(res.msg);
                    }
                }
            });
            return false;
        });
    });
</script>
</html>
